﻿#include "device_simulator/rtsp_server.h"
#include <thread>
#include "device_simulator/http_server.h"

static void rtsp_thread_func() {
  EventLoop::Ptr event_loop(new EventLoop());
  if (!event_loop->Initialize()) {
    return;
  }

  RtspServer::Ptr rtsp_server(new RtspServer(event_loop));
  rtsp_server->Start("0.0.0.0", 10086);

  event_loop->Run();

  event_loop->Uninitialize();
}

static void http_thread_func() {
  HttpServer::Ptr http_server(new HttpServer());
}

int main(int argc, char *argv[]) {
  if (!InitializeNet()) {
    std::cout << "Initialize network failed!" << std::endl;
    return false;
  }

  std::thread rtsp_thread(rtsp_thread_func);
  // std::thread http_thread(http_thread_func);

  rtsp_thread.join();
  // http_thread.join();

  UninitializeNet();
  return 0;
}
